package com.tdkj.model.shop;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;

/**
 * Auction entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "shop_good_auction")
public class BeanGoodAuction extends BaseEntity {

	private Date startTime;
	private Date endTime;
	private BeanGood good;
	private List<BeanGoodAuctionQuote> quotes;
	private BeanGoodAuctionQuote finalQuote;
	private Integer quantity;
	
	//0,1
	private String state;

	/**
	 * @return the good
	 */
	@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH})
	@JoinColumn(name="good_id")
	public BeanGood getGood() {
		return good;
	}

	/**
	 * @param good the good to set
	 */
	public void setGood(BeanGood good) {
		this.good = good;
	}

	/**
	 * @return the startTime
	 */
	public Date getStartTime() {
		return startTime;
	}

	/**
	 * @param startTime the startTime to set
	 */
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	/**
	 * @return the endTime
	 */
	public Date getEndTime() {
		return endTime;
	}

	/**
	 * @param endTime the endTime to set
	 */
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	/**
	 * @return the quotes
	 */
	@OneToMany(fetch=FetchType.LAZY, cascade={CascadeType.REFRESH}, mappedBy="auction")
	public List<BeanGoodAuctionQuote> getQuotes() {
		return quotes;
	}

	public void setQuotes(List<BeanGoodAuctionQuote> quotes) {
		this.quotes = quotes;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@OneToOne(fetch=FetchType.EAGER, cascade={CascadeType.REFRESH})
	@JoinColumn(name="final_quote_id")
	public BeanGoodAuctionQuote getFinalQuote() {
		return finalQuote;
	}

	public void setFinalQuote(BeanGoodAuctionQuote finalQuote) {
		this.finalQuote = finalQuote;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	
}